from rest_framework.views import APIView, Response
from rest_framework import serializers
from .. import models


class AccountSerializers(serializers.ModelSerializer):

    class Meta:
        model = models.AccountInfo
        fields = '__all__'


class AccountAPIView(APIView):

    def get(self, request):
        queryset = models.AccountInfo.objects.all()
        account = AccountSerializers(instance=queryset, many=True)
        data = {'data': account.data, 'code': 0}
        return Response(data=data)

